#pragma once

#include "IRoom.hh"
#include "Item.hh"
#include "Enemy.hh"
#include <string>

// 普通房间类
class NormalRoom : public IRoom {
private:
    int id_;               // 房间ID
    int floor_;           // 所在楼层
    std::string desc_;    // 房间描述
public:
    NormalRoom();
    NormalRoom(const NormalRoom& other);
    NormalRoom& operator=(const NormalRoom& other);
    ~NormalRoom();

    NormalRoom(int id, const std::string& desc, int floor);
    int getRoomNumber() const override;            // 获取房间号
    std::string getCategory() const override;      // 获取房间类型
    std::string getDescription() const override;   // 获取房间描述
    void displayInfo() const override;             // 显示房间信息
    void enter(Player* player) override;           // 进入房间
    int getFloor() const override;                 // 获取所在楼层
};

// 出口房间类
class ExitRoom : public IRoom {
    private:
        int id_;               
        int floor_;           
        std::string desc_;    
        int nextFloor_;       // 下一层楼层号
        
    public:
        ExitRoom();
        ExitRoom(const ExitRoom& other);
        ExitRoom& operator=(const ExitRoom& other);
        ~ExitRoom();

        ExitRoom(int id, const std::string& desc, int nextFloor, int floor);
        ExitRoom(int id, const std::string& desc);
        int getRoomNumber() const override;            
        std::string getCategory() const override;      
        std::string getDescription() const override;   
        void displayInfo() const override;             
        void enter(Player* player) override;           
        int getFloor() const override;                 
    };

// 物品房间类
class ItemRoom : public IRoom {
private:
    int id_;                                   
    int floor_;                               
    std::string desc_;                        
    const std::map<int, Item>& possibleItems_;     // 可能出现的物品列表
public:
    ItemRoom();
    ItemRoom(const ItemRoom& other);
    ItemRoom& operator=(const ItemRoom& other);
    ~ItemRoom();

    ItemRoom(int id, const std::string& desc, const std::map<int, Item>& items, int floor);
    int getRoomNumber() const override;            
    std::string getCategory() const override;      
    std::string getDescription() const override;   
    void displayInfo() const override;             
    void enter(Player* player) override;           
    Item getRandomItem();                          // 随机获取一个物品
    int getFloor() const override;                 
};

// 怪物房间类
class MonsterRoom : public IRoom {
private:
    int id_;              
    int floor_;           
    std::string desc_;    
    Enemy* enemy_;        // 房间内的敌人
    int reward_;          // 击败怪物的奖励
public:
    MonsterRoom();
    MonsterRoom(const MonsterRoom& other);
    MonsterRoom& operator=(const MonsterRoom& other);
    ~MonsterRoom();

    MonsterRoom(int id, const std::string& desc,  Enemy* enemy, int reward, int floor);
    int getRoomNumber() const override;            
    std::string getCategory() const override;      
    std::string getDescription() const override;   
    void displayInfo() const override;             
    void enter(Player* player) override;           
    int getFloor() const override;                 
};

// 治疗房间类
class HealingRoom : public IRoom {
private:
    int id_;              
    int floor_;           
    std::string desc_;    
public:
    HealingRoom();
    HealingRoom(const HealingRoom& other);
    HealingRoom& operator=(const HealingRoom& other);
    ~HealingRoom();

    HealingRoom(int id, const std::string& desc, int floor);
    int getRoomNumber() const override;           
    std::string getCategory() const override;     
    std::string getDescription() const override;  
    void displayInfo() const override;            
    void enter(Player* player) override;          
    int getFloor() const override;                
};
